package class1;

public class Static {
    private int year;

    Static(int year) {
        this.year=year;

    }

    public static boolean isLeap(int y) {  //加上static为类方法
        return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0;
    }

    public boolean isLeap() {//判断类实例的日期的年份是否为闰年
        return isLeap(year); //判断的对象是方法所属的实例字段year
    }

    public static void main(String[] args) {
        Static year = new Static(2008);
        if (year.isLeap())
            System.out.println("闰年");
        else
            System.out.println("不是闰年");
    }
}
